insert into hse_category_cause([CAUSE_NAME] ,[CAUSE_TYPE]) values('其他。', 2)
go
delete from hse_category_cause where ID = 21
go
update hse_category set REMOTE_CAUSE_ID = 27 where REMOTE_CAUSE_ID = 21
go
update problem_hse_category set REMOTE_CAUSE_ID = 27 where REMOTE_CAUSE_ID = 21
go

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING OFF
GO

CREATE TABLE [dbo].[deleted_problem_hse_category](
	[PROBLEM_ID] [int] NOT NULL,
	[HSE_CATEGORY_ID] [int] NOT NULL,
	[HSE_CATEGORY_TYPE] [tinyint] NOT NULL,
	[DIRECT_CAUSE_ID] [int] NULL,
	[REMOTE_CAUSE_ID] [int] NULL,
	[OTHER] [varchar](60) NULL,
 CONSTRAINT [PK_deleted_problem_hse_category] PRIMARY KEY CLUSTERED 
(
	[PROBLEM_ID] ASC,
	[HSE_CATEGORY_ID] ASC,
	[HSE_CATEGORY_TYPE] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

update problem set GRADE = GRADE * 10 where GRADE is not null
go

SET IDENTITY_INSERT [dbo].[equipment] ON
insert into equipment(ID, EQUIP_NAME, DEPARTMENT_ID) values (0, N'无装置', 0)
SET IDENTITY_INSERT [dbo].[equipment] OFF
go

insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(7,9 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(7,8 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(7,6 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(7,5 ,1, 1)
go

/****** Object:  Table [dbo].[postcheck_month_check_report]    Script Date: 10/07/2012 00:53:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[postcheck_month_check_report](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[PROBLEM_ID] [int] NULL,
	[YEAR] [smallint] NOT NULL,
	[MONTH] [tinyint] NOT NULL,
	[DEPARTMENT1_ID] [int] NULL,
	[CHECK_REPORT] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_postcheck_month_check_report] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[deleted_postcheck_month_check_report]    Script Date: 10/07/2012 00:56:07 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[deleted_postcheck_month_check_report](
	[ID] [int] NOT NULL,
	[PROBLEM_ID] [int] NULL,
	[YEAR] [smallint] NOT NULL,
	[MONTH] [tinyint] NOT NULL,
	[DEPARTMENT1_ID] [int] NULL,
	[CHECK_REPORT] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_deleted_postcheck_month_check_report] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[postcheck_month_sanwei_report](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[PROBLEM_ID] [int] NULL,
	[YEAR] [smallint] NOT NULL,
	[MONTH] [tinyint] NOT NULL,
	[DEPARTMENT1_ID] [int] NOT NULL,
	[SANWEI_REPORT] [varbinary](max) NOT NULL,
 CONSTRAINT [PK_postcheck_month_sanwei_report] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(8,10 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(8,11 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(8,12 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(8,13 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(8,14 ,1, 1)
go

alter table postcheck_month_sanwei_report alter column DEPARTMENT1_ID int null
go

insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(9,10 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(9,11 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(9,12 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(9,13 ,1, 1)
go
insert into role_auth(AUTH_TYPE, ROLE_ID, PROCESS_METHOD, HAS_RIGHT) values(9,14 ,1, 1)
go